﻿#pragma once

#include <QGraphicsScene>
#include "DefineItemType.h"

class GraphicsScene : public QGraphicsScene
{
    Q_OBJECT

public:
    GraphicsScene(QObject *parent = nullptr);
    void startCreate(DefineItemType itemType);
    void cancelCreate();
    void finishCreate();

protected:
    virtual void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
    virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
    virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;

signals:
    void sigPointPush(QPointF p, int index);
    void sigPointMove(QPointF p);
    void sigCreateFinished();

protected:
    bool isDrawStatus;
    DefineItemType drawType;
    QList<QPointF> pointList;
};
